package com.example.leetcode.design.listener.basic;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class ObserverAction {

    private Object target;


    private Method method;


    public ObserverAction(Object target, Method method) {
        this.target = target;
        this.method = method;
    }


    public void execute(Object event){
        try {
            method.invoke(target,event);
        }catch (InvocationTargetException | IllegalStateException | IllegalAccessException e){
            e.printStackTrace();
        }
    }
}
